home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Classes / ScrollingTextField / ScrollTextField_Source / ScrollTextFieldInspector.m < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.3 KB  |  107 lines

  1.  
  2. /* Generated by Interface Builder */
  3. // Uncopyrighted by Eric Celeste, 1991 <efc@mit.edu>
  4.  
  5. #import "ScrollTextFieldInspector.h"
  6. #import "ScrollTextField.h"
  7. #import <appkit/Application.h>
  8. #import <appkit/TextFieldCell.h>
  9. #import <appkit/TextField.h>
  10. #import <appkit/Matrix.h>
  11. #import <appkit/Window.h>
  12. #import <appkit/Text.h>
  13. #import <appkit/Box.h>
  14.  
  15. @implementation ScrollTextFieldInspector
  16. /* << The first two class methods don't get inherited >> */
  17.  
  18. + finishLoading:(struct mach_header *) hdr {
  19.     NIBDidLoadClass(self, hdr);
  20.     return nil;
  21. }
  22.  
  23. + startUnloading
  24. {
  25.     NIBWillUnloadClass(self);
  26.     return nil;
  27. }
  28.  
  29. - init
  30. {
  31.     [super init];
  32.     [NXApp loadNibSection:"ScrollTextFieldInspector.nib" owner:self];
  33.     return self;
  34. }
  35.  
  36.  
  37. - ok:sender
  38. {
  39.     int t;
  40.     
  41.     [[NXApp mainWindow] makeFirstResponder:[NXApp mainWindow]];
  42.     [window endEditingFor:self];
  43.  
  44.     if ((t = [[backGrayMatrix selectedCell] tag]) == 0) {
  45.         [object setBackgroundGray:-1.0];
  46.     } else {
  47.         [object setBackgroundGray:(t - 1) / 3.0];
  48.     }
  49.  
  50.     [object setTextGray:[[textGrayMatrix selectedCell] tag] / 3.0];
  51.  
  52.     [object setBorderType:[[borderMatrix selectedCell] tag]];
  53.     
  54.     [object setEditable:(t = [[optionsMatrix cellAt:1 :0] state])];
  55.     [object setMonofont:[[optionsMatrix cellAt:2 :0] state]];
  56.  
  57.     [[optionsMatrix cellAt:0 :0] setEnabled:(!t)];
  58.     if (t) {
  59.         [object setSelectable:t];
  60.     } else {
  61.         [object setSelectable:[[optionsMatrix cellAt:0 :0] state]];
  62.     }
  63.  
  64.     return[super ok:sender];
  65. }
  66.  
  67. - revert:sender
  68. {
  69.     [window endEditingFor:self];
  70.  
  71.     if ([object backgroundGray] < 0.0) {
  72.         [backGrayMatrix selectCellAt:0 :0];
  73.     } else {
  74.         [backGrayMatrix selectCellAt:0 :([object backgroundGray] * 3.0) + 1];
  75.     }
  76.     
  77.     [textGrayMatrix selectCellAt:0 :([object textGray] * 3.0)];
  78.  
  79.     [borderMatrix selectCellAt:0 :[object borderType]];
  80.  
  81.     [[optionsMatrix cellAt:2 :0] setState:[object isMonofont]];
  82.     [[optionsMatrix cellAt:1 :0] setState:[object isEditable]];
  83.     
  84.     [[optionsMatrix cellAt:0 :0] setEnabled:(![object isEditable])];
  85.     if ([object isEditable]) {
  86.         [[optionsMatrix cellAt:0 :0] setState:YES];
  87.     } else {
  88.         [[optionsMatrix cellAt:0 :0] setState:[object isSelectable]];
  89.     }
  90.     
  91.     return[super revert:sender];
  92. }
  93.  
  94. - setOptionsSelectable:sender
  95. {
  96.     BOOL x;
  97.     
  98.     x = [[sender selectedCell] state];
  99.     [[optionsMatrix cellAt:0 :0] setEnabled:(! x)];
  100.     if (x) {
  101.         [[optionsMatrix cellAt:0 :0] setState:(x)];
  102.     }
  103.     
  104.     return self;
  105. }
  106. @end
  107.